<html><head><title>GetActiveGadget</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">GetActiveGadget()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#006666"><b>GetActiveGadget</b></font>()</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Returns the gadget number of the Gadget that currently has the keyboard focus. 

</blockquote><p><b>Parameters</b></p><blockquote>
None.


</blockquote><p><b>Return value</b></p><blockquote>

Returns the #Gadget number of the Gadget with the focus. 
If no Gadget has the focus, -1 is returned. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">If</font></b> <font color="#006666">OpenWindow</font>(0, 0, 0, 270, 70, "GetActiveGadget", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#006666">    StringGadget  </font>(0, 10, 10, 250, 20, "Press escape...")
<font color="#006666">    StringGadget  </font>(1, 10, 40, 250, 20, "Press escape...")
<font color="#006666">    AddKeyboardShortcut</font>(0, <font color="#924B72">#PB_Shortcut_Escape</font>, 1)
<font color="#006666">    SetActiveGadget</font>(0)
    <b><font color="#006666">Repeat</font></b>
      Event =<font color="#006666"> WaitWindowEvent</font>()
      <b><font color="#006666">If</font></b> Event = <font color="#924B72">#PB_Event_Menu</font> <b><font color="#006666">And</font></b> <font color="#006666">EventMenu</font>() = 1
<font color="#006666">        MessageRequester</font>("Test", "Escape pressed in Gadget " +<font color="#006666"> Str</font>(<font color="#006666">GetActiveGadget</font>()))
      <b><font color="#006666">EndIf</font></b>
    <b><font color="#006666">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#006666">EndIf</font></b>
</font></pre>

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=gadgety.html>GadgetY()</a> - <a href=index.html>Gadget Index</a> - <a href=getgadgetattribute.html>GetGadgetAttribute()</a> ->

</body></html>